import fetch from '@/utils/fetch'

export function apiGetClientList(listQuery) {
  return fetch({
    url: '/api/v1/customer/list',
    method: 'get',
    params: listQuery
  })
}

export function apiGetClientById(clientId) {
  return fetch({
    url: '/api/v1/customer',
    method: 'get',
    params: {
      id: clientId
    }
  })
}

export function apiAddClient(clientDto) {
  return fetch({
    url: '/api/v1/customer',
    method: 'post',
    data: clientDto
  })
}

export function apiUpdClient(clientDto) {
  return fetch({
    url: '/api/v1/customer',
    method: 'put',
    data: clientDto
  })
}

export function apiDelClient(clientId) {
  return fetch({
    url: '/api/v1/customer',
    method: 'delete',
    params: {
      id: clientId
    }
  })
}


export function apiGetRepairCustomerList(listQuery) {
  return fetch({
    url: '/api/v1/customer/maintenance',
    method: 'GET',
    params: listQuery
  })
}

export function apiExport (listQuery) {
  return fetch({
    url: '/api/v1/customer/export',
    method: 'post',
    data: listQuery,
    responseType: 'arraybuffer'
  })
}
